import service from '@/utils/request'
export const API_WORKFLOW = {
    // 查询流程定义列表
        listDefinition:(query) =>{
        return service({
            url: '/workflow/definition/list',
            method: 'get',
            params: query
        })
        },

        // 部署流程定义
        deployProcess:(formData:FormData) => {
            return service.post('/workflow/deploy', formData, {
                headers: {
                'Content-Type': 'multipart/form-data',
                },
            })

        },

        // 删除流程定义
        delDefinition:(deploymentId) => {
        return service({
            url: '/workflow/definition/' + deploymentId,
            method: 'delete'
        })
        },

        // 启动流程实例
        startProcess:(processDefinitionKey, data) => {
        return service({
            url: '/workflow/start/' + processDefinitionKey,
            method: 'post',
            data: data
        })
        },

        // 查询待办任务
        listTasks:(query) => {
        return service({
            url: '/workflow/tasks',
            method: 'get',
            params: query
        })
        },

        // 完成任务
        completeTask:(taskId, data)  =>{
        return service({
            url: '/workflow/task/complete/' + taskId,
            method: 'post',
            data: data
        })
        },

        // 获取流程图
        getProcessDiagram:(processInstanceId)  =>{
        return service({
            url: '/workflow/diagram/' + processInstanceId,
            method: 'get',
            responseType: 'blob'
        })
        }

}
